﻿using System;

using XEvent.Events.Base.SubScription;

namespace XEvent.Events.Base
{
    public class PubSubEvent<T> : EventBase
    {
        public virtual void Publish(T payload)
        {
            OnPublish(payload);
        }

        public virtual SubScriptionToken Subscribe(Action<T> action, Predicate<T> filter)
        {
            ISubScriptionToken subScriptionToken = new EventSubScriptionToken<T>(action, filter);
            return OnSubscribe(subScriptionToken);
        }


    }
}
